<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>bui.router</title>
    <!-- <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css"> -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="../assets/css/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
    <!-- <script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script> -->
    <script src="../assets/js/jquery-1.9.1.min.js"></script>
    <script src="../assets/js/index.js"></script>
    <script src="../assets/js/yui-min.js"></script>
    <script src="../assets/js/combo/oop-min.js"></script>
    <script src="../assets/js/combo/array-extras-min.js"></script>
    <script src="../assets/js/combo/autocomplete.js"></script>
    <script src="../assets/js/combo/history-base-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="sidemenu" class="sidebar-menu">菜单</div>
<div id="doc">
    <div id="hd" class="yui3-g header">
        <div class="yui3-u-3-4">
            
                <h1><a href="../index.html"><img src="../assets/css/logo.png" title="" width="30px"></a>
                <a href="../index.html">BUI</a>
                
                </h1>
            
            <p class="off-left">其它版本:<select name="" id="" onchange="window.location.href=this.value"><option value="../api/index.html" selected>1.5.0</option><option value="../api-1.4.8/index.html">1.4.8</option></select></p>
            <p class="off-left" style="font-size:12px;margin-right: 15px;">API for BUI 1.5.4 </p>
            
        </div>
    </div>
    <div id="bd" class="yui3-g">

        <div id="sidebar" class="yui3-u-1-4">
            <div id="docs-sidebar" class="sidebar apidocs">
                <div id="api-list">
    <div id="api-tabview" class="tabview">

        <ul class="tabs">
            <li><a href="#api-classes">Classes</a></li>
            <li><a href="#api-modules">Modules</a></li>
        </ul>

        <div id="api-tabview-filter">
            <input type="search" id="api-filter" placeholder="Type to filter APIs">
        </div>

        <div id="api-tabview-panel">
            <ul id="api-classes" class="apis classes">
            
                <li><a href="../classes/bui.accordion.html">bui.accordion</a></li>
            
                <li><a href="../classes/bui.actionsheet.html">bui.actionsheet</a></li>
            
                <li><a href="../classes/bui.ajax.html">bui.ajax</a></li>
            
                <li><a href="../classes/bui.alert.html">bui.alert</a></li>
            
                <li><a href="../classes/bui.all.html">bui.all</a></li>
            
                <li><a href="../classes/bui.animate.html">bui.animate</a></li>
            
                <li><a href="../classes/bui.array.html">bui.array</a></li>
            
                <li><a href="../classes/bui.back.html">bui.back</a></li>
            
                <li><a href="../classes/bui.btn.html">bui.btn</a></li>
            
                <li><a href="../classes/bui.config.html">bui.config</a></li>
            
                <li><a href="../classes/bui.confirm.html">bui.confirm</a></li>
            
                <li><a href="../classes/bui.delete.html">bui.delete</a></li>
            
                <li><a href="../classes/bui.dialog.html">bui.dialog</a></li>
            
                <li><a href="../classes/bui.download.html">bui.download</a></li>
            
                <li><a href="../classes/bui.dropdown.html">bui.dropdown</a></li>
            
                <li><a href="../classes/bui.emitter.html">bui.emitter</a></li>
            
                <li><a href="../classes/bui.file.html">bui.file</a></li>
            
                <li><a href="../classes/bui.fileselect.html">bui.fileselect</a></li>
            
                <li><a href="../classes/bui.get.html">bui.get</a></li>
            
                <li><a href="../classes/bui.getPageParams.html">bui.getPageParams</a></li>
            
                <li><a href="../classes/bui.guid.html">bui.guid</a></li>
            
                <li><a href="../classes/bui.hint.html">bui.hint</a></li>
            
                <li><a href="../classes/bui.init.html">bui.init</a></li>
            
                <li><a href="../classes/bui.input.html">bui.input</a></li>
            
                <li><a href="../classes/bui.levelselect.html">bui.levelselect</a></li>
            
                <li><a href="../classes/bui.list.html">bui.list</a></li>
            
                <li><a href="../classes/bui.listview.html">bui.listview</a></li>
            
                <li><a href="../classes/bui.load.html">bui.load</a></li>
            
                <li><a href="../classes/bui.loader.html">bui.loader</a></li>
            
                <li><a href="../classes/bui.loading.html">bui.loading</a></li>
            
                <li><a href="../classes/bui.mask.html">bui.mask</a></li>
            
                <li><a href="../classes/bui.number.html">bui.number</a></li>
            
                <li><a href="../classes/bui.pickerdate.html">bui.pickerdate</a></li>
            
                <li><a href="../classes/bui.platform.html">bui.platform</a></li>
            
                <li><a href="../classes/bui.post.html">bui.post</a></li>
            
                <li><a href="../classes/bui.prompt.html">bui.prompt</a></li>
            
                <li><a href="../classes/bui.pullrefresh.html">bui.pullrefresh</a></li>
            
                <li><a href="../classes/bui.put.html">bui.put</a></li>
            
                <li><a href="../classes/bui.rating.html">bui.rating</a></li>
            
                <li><a href="../classes/bui.ready.html">bui.ready</a></li>
            
                <li><a href="../classes/bui.refresh.html">bui.refresh</a></li>
            
                <li><a href="../classes/bui.router.html">bui.router</a></li>
            
                <li><a href="../classes/bui.run.html">bui.run</a></li>
            
                <li><a href="../classes/bui.scroll.html">bui.scroll</a></li>
            
                <li><a href="../classes/bui.searchbar.html">bui.searchbar</a></li>
            
                <li><a href="../classes/bui.select.html">bui.select</a></li>
            
                <li><a href="../classes/bui.sidebar.html">bui.sidebar</a></li>
            
                <li><a href="../classes/bui.slide.html">bui.slide</a></li>
            
                <li><a href="../classes/bui.stepbar.html">bui.stepbar</a></li>
            
                <li><a href="../classes/bui.storage.html">bui.storage</a></li>
            
                <li><a href="../classes/bui.store.html">bui.store</a></li>
            
                <li><a href="../classes/bui.swipe.html">bui.swipe</a></li>
            
                <li><a href="../classes/bui.tab.html">bui.tab</a></li>
            
                <li><a href="../classes/bui.typeof.html">bui.typeof</a></li>
            
                <li><a href="../classes/bui.unit.html">bui.unit</a></li>
            
                <li><a href="../classes/bui.upload.html">bui.upload</a></li>
            
                <li><a href="../classes/bui.viewport.html">bui.viewport</a></li>
            
            </ul>

            <ul id="api-modules" class="apis modules">
            
                <li><a href="../modules/Animate.html">Animate</a></li>
            
                <li><a href="../modules/Core.html">Core</a></li>
            
                <li><a href="../modules/Event.html">Event</a></li>
            
                <li><a href="../modules/Method.html">Method</a></li>
            
                <li><a href="../modules/Native.html">Native</a></li>
            
                <li><a href="../modules/UI.html">UI</a></li>
            
            </ul>
        </div>
    </div>
</div>
 
            </div>
        </div>
        <div class="yui3-u-3-4">
                <div id="api-options">
        Show:
        <label for="api-show-inherited">
            <input type="checkbox" id="api-show-inherited" checked>
            Inherited
        </label>

        <label for="api-show-protected">
            <input type="checkbox" id="api-show-protected">
            Protected
        </label>

        <label for="api-show-private">
            <input type="checkbox" id="api-show-private">
            Private
        </label>
        <label for="api-show-deprecated">
            <input type="checkbox" id="api-show-deprecated">
            Deprecated
        </label>

    </div>


            <div class="apidocs">
                <div id="docs-main">
                    <div class="content">
                        <h1>bui.router Class</h1>
<div class="box meta">
    

    

    
        <div class="foundat">
            Defined in: <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l10"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:10</code></a>
        </div>
    

    
        
            Module: <a href="../modules/Core.html">Core</a>
        
    

    
        <p>Available since 1.4.0</p>
    
</div>



<div class="box intro">
    <div class="oui-fluid">
   <div class="span8">
     <h2>BUI 单页路由器</h2>
     <p><a href="http://www.easybui.com/docs/index.html?id=buirouter" target="_parent" style="color:red;">单页路由入门文档</a></p>
     <p>开启单页路由以后, 同样可以使用 bui.back (页面后退) , bui.load (页面跳转) , bui.getPageParams (获取对应的参数), 保持跟多页的开发方式一致有利于后面单页满足不了需求的时候进行切换.</p>
     <p>路由依赖于 <a href="../classes/bui.loader.html" class="crosslink">bui.loader</a>, 具体查看模块的API. </p>
     <p>路由默认已经初始化了一个main模块, 通过loader.map 可以修改首页的路径,一般无需修改</p>
     <h3>预览地址: <a href="../../index.html#pages/router/index.html" target="_blank">demo</a></h3>
     <p>功能点:</p>
     <p>1. 页面跳转,支持模块跳转或者html跳转,支持动画 <a href="../classes/bui.router.html#method_load" class="crosslink">load</a></p>
     <p>2. 指定后退几层,并且可以执行回调 <a href="../classes/bui.router.html#method_back" class="crosslink">back</a></p>
     <p>3. 页面刷新,后退刷新 <a href="../classes/bui.router.html#method_refresh" class="crosslink">refresh</a></p>
     <p>4. 页面替换 <a href="../classes/bui.router.html#method_replace" class="crosslink">replace</a></p>
     <p>5. 局部加载 <a href="../classes/bui.router.html#method_loadPart" class="crosslink">loadPart</a></p>
     <p>6. 页面传参,配合load,获取参数 <a href="../classes/bui.router.html#method_getPageParams" class="crosslink">getPageParams</a></p>
     <p>7. 局部传参,配合loadPart,获取参数 <a href="../classes/bui.router.html#method_getPartParams" class="crosslink">getPartParams</a></p>
     <p>8. 检测当前页面是否已经加载一次 <a href="../classes/bui.router.html#method_isLoad" class="crosslink">isLoad</a></p>
     <p>9. 返回当前页面Dom对象 <a href="../classes/bui.router.html#method_currentPage" class="crosslink">currentPage</a></p>
     <p>10. 返回当前模块对象 <a href="../classes/bui.router.html#method_currentModule" class="crosslink">currentModule</a></p>
     <p>11. 预加载模板 <a href="../classes/bui.router.html#method_preload" class="crosslink">preload</a></p>
     <p>12. 修改切换效果</p>
   </div>
   <div class="span4"><a href="../../index.html#pages/router/index.html" target="_blank"><img src="http://www.easybui.com/static/images/controls/bui-router_low.gif" alt="BUI单页路由"/></a></div>
 </div>
</div>


    <div class="constructor">
        <h2>Constructor</h2>
        <div id="method_bui.router" class="method item">
    <h3 class="name"><code>bui.router</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code class="optional">[option]</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l10"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:10</code></a>
        
        </p>


        

        
            <p>Available since 1.4.0</p>
        
    </div>

    <div class="description">
        
    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name optional">[option]</code>
                        <span class="type">Object</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                        <ul class="params-list">
                            
                            <li class="param">
                                
                                    <code class="param-name">id</code>
                                    <span class="type">String</span>
                                

                                <div class="param-description">
                                    <p>[路由初始化的id]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[progress]</code>
                                    <span class="type">Boolean</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[默认: false 关闭 | true 开启, 页面跳转是否开启进度条]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[effect]</code>
                                    <span class="type">String</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[默认: push | slide | cover | zoom | fadein | fadeinslide | none ]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[indexModule]</code>
                                    <span class="type">Object</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[ 1.4.3新增, 首页地址配置, 默认: { moduleName: &quot;main&quot;,template: &quot;pages/main/main.html&quot;, script: &quot;pages/main/main.js&quot; } ]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[height]</code>
                                    <span class="type">Number</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[1.4.7新增 默认: 0 ]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[cache]</code>
                                    <span class="type">Boolean</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[默认: true ,缓存模板,下次再进入不会继续请求,速度会快一些 ]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[hash]</code>
                                    <span class="type">Boolean</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[1.5.1新增 hash跳转模式 默认: false , 可以用来处理刷新以后后退不了的问题, 相比reloadCache参数,不用加载那么多缓存,但也就后退没有动画效果. ]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[reloadCache]</code>
                                    <span class="type">Boolean</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[1.4.1新增 默认: false | true , 刷新是否可以后退, 为true时可以加载之前的路由页面, 建议部署的时候有必要再开启 ]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[syncHistory]</code>
                                    <span class="type">Boolean</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[默认: true ,同步浏览器历史记录,这样可以兼容手机的后退按键,为false则页面地址不会,例如:appcan平台,使用打包以后没有历史记录,所以需要设置false ]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[firstAnimate]</code>
                                    <span class="type">Boolean</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[1.4.2默认: false 等数据加载结束再切换,本地打包速度较快 | true 先执行页面切换,再执行页面加载,这样切换速度较快,但页面会先空白,webapp受网络影响,建议开启,并且开启进度条 ]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[beforeBack]</code>
                                    <span class="type">Function |  | Boolean</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[1.5.1默认: null 每次后退前触发, 如果返回 false 则不后退, 不返回或者返回true 都会后退. ]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[beforeLoad]</code>
                                    <span class="type">Function |  | Boolean</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[1.5.1默认: null 每次跳转前触发, 如果返回 false 则不跳转, 不返回或者返回true 都会跳转. ]</p>

                                </div>

                                
                            </li>
                            
                        </ul>
                    
                </li>
            
            </ul>
        </div>
    

    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <p>  html: 
     <xmp>
        <div id="bui-router"></div>
     </xmp>
   js:</p>
<pre class="code prettyprint"><code> // 把路由实例化给 window.router

  window.router = bui.router();
 bui.ready(function(){
    // 路由初始化
    router.init({
        id: &quot;#bui-router&quot;,
        hash:true
    })
  })
 js: 路由权限拦截
  // 判断示例,正常用户信息应该使用 bui.storage 来操作. 
  var userinfo = null;
  bui.ready(function(){
    router.init({
        id: &quot;#bui-router&quot;,
        beforeLoad: function(e) {
            // 如果没有登录,并且当前页面不是登录页面,则执行跳转, 并且要return false; 这样没有历史记录,不能使用后退.
            if( !userinfo &amp;&amp; e.target.pid !== &quot;pages/login/login&quot;){
                router.load({
                    url:&quot;pages/login/login.html&quot;
                })
                return false;
            }
        }
    })
  })</code></pre>

            </div>
        </div>
    
</div>

    </div>


<div id="classdocs" class="tabview">
    <ul class="api-class-tabs">
        <li class="api-class-tab index"><a href="#index">Index</a></li>

        
            <li class="api-class-tab methods"><a href="#methods">Methods</a></li>
        
        
        
        
            <li class="api-class-tab events"><a href="#events">Events</a></li>
        
    </ul>

    <div>
        <div id="index" class="api-class-tabpanel index">
            <h2 class="off-left">Item Index</h2>

            
                <div class="index-section methods">
                    <h3>Methods</h3>

                    <ul class="index-list methods">
                        
                            <li class="index-item method">
                                <a href="#method_$">$</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_back">back</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_currentModule">currentModule</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_currentPage">currentPage</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_destroy">destroy</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_getPageParams">getPageParams</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_getPartParams">getPartParams</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_history">history</a>

                                
                                    <span class="flag static">static</span>
                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_init">init</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_initScroll">initScroll</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_isLoad">isLoad</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_load">load</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_loadPart">loadPart</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_option">option</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_preload">preload</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_refresh">refresh</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_replace">replace</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_resize">resize</a>

                                
                                
                            </li>
                        
                    </ul>
                </div>
            

            

            

            
                <div class="index-section events">
                    <h3>Events</h3>

                    <ul class="index-list events">
                        
                            <li class="index-item event">
                                <a href="#event_off">off</a>

                                
                                
                            </li>
                        
                            <li class="index-item event">
                                <a href="#event_on">on</a>

                                
                                
                            </li>
                        
                    </ul>
                </div>
            
        </div>

        
            <div id="methods" class="api-class-tabpanel">
                <h2 class="off-left">Methods</h2>

                
                    <div id="method_$" class="method item">
    <h3 class="name"><code>$</code></h3>

    
        <span class="paren">()</span>
    

    
        <span class="returns-inline">
            <span class="type">Object</span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l2424"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:2424</code></a>
        
        </p>


        

        
            <p>Available since 1.4.5</p>
        
    </div>

    <div class="description">
        <p>单页里面的选择器,只选择当前页面的元素</p>

    </div>

    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Object</span>:
                    
                    <p>[$对象]</p>

                
            </div>
        </div>
    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>       // 比方当前页的事件绑定
       router.$(&quot;#id&quot;).on(&quot;click&quot;,function (argument) {

       })

       // 比方第三方vue所在的页面需要重复加载
       var vue = new Vue({
           el: router.$(&quot;#id&quot;)[0]
       })</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_back" class="method item">
    <h3 class="name"><code>back</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code class="optional">[option]</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    

    
        <span class="flag chainable">chainable</span>
    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l1786"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:1786</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>页面返回,支持回调,跟返回多层</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name optional">[option]</code>
                        <span class="type">Object</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                        <ul class="params-list">
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[index]</code>
                                    <span class="type">Number</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[默认:-1, 后退1层 ,负数,如果后退的层级大于历史记录,则退回到首页]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[name]</code>
                                    <span class="type">Number</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[ 1.4.1新增 指定模块名称,该模块如果未存在,则后退一层]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[beforeBack]</code>
                                    <span class="type">Function |  | Boolean</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[1.5.1默认: null 每次后退前触发, 如果返回 false 则不后退, 不返回或者返回true 都会后退. ]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[callback]</code>
                                    <span class="type">Function</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[后退以后执行回调,回调里可以拿到后退模块的return值]</p>

                                </div>

                                
                            </li>
                            
                        </ul>
                    
                </li>
            
            </ul>
        </div>
    

    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>       方法1:

       router.back();

       方法2: 后退上2页

       router.back({ index: -2 });

       方法3: 后退以后刷新

       router.back({
         callback: function() {
           router.refresh();
         }
       });

       方法4: 后退以后执行当前模块的方法

       router.back({
         callback: function(mod) {
           mod.init();
         }
       });

       方法5: 全局监听后退事件
       router.on(&quot;back&quot;,function (e) {
           // 如果回退到首页则刷新页面
             loader.require([&quot;main&quot;],function(main){
               // 刷新main
               main.init()
             })
       })</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_currentModule" class="method item">
    <h3 class="name"><code>currentModule</code></h3>

    
        <span class="paren">()</span>
    

    
        <span class="returns-inline">
            <span class="type">Object</span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l2380"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:2380</code></a>
        
        </p>


        

        
            <p>Available since 1.4.2</p>
        
    </div>

    <div class="description">
        <p>获取最后一个历史记录的模块信息,可以用于检测当前在某个模块下</p>

    </div>

    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Object</span>:
                    
                    <p>[{ pid: }]</p>

                
            </div>
        </div>
    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>       var currentModule = router.currentModule();</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_currentPage" class="method item">
    <h3 class="name"><code>currentPage</code></h3>

    
        <span class="paren">()</span>
    

    
        <span class="returns-inline">
            <span class="type">Object</span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l2395"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:2395</code></a>
        
        </p>


        

        
            <p>Available since 1.4.2</p>
        
    </div>

    <div class="description">
        <p><del>获取当前页面下的DOM对象, 常用于当前模块事件绑定,
防止重复加载相同模块,导致事件重复绑定, 也适用于控件的重复,</del> 1.5以后，直接使用 router.$ 替换 $ 选择器就可以了</p>

    </div>

    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Object</span>:
                    
                    <p>[DOM对象]</p>

                
            </div>
        </div>
    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>       var currentPage = router.currentPage();

       // 绑定当前区域的按钮
       $(currentPage).on(&quot;click&quot;,&quot;.btn&quot;,function (e) {
         console.log(this);
       })

       // 当前区域的控件初始化
       var currentAccordion = $(&quot;.bui-accordion&quot;,currentPage);
       var uiAccordion = bui.accordion({
           id: currentAccordion
       });</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_destroy" class="method item">
    <h3 class="name"><code>destroy</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code class="optional">[销毁某个页面]</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    

    
        <span class="flag chainable">chainable</span>
    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l1968"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:1968</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>页面返回,支持回调,跟返回多层</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name optional">[销毁某个页面]</code>
                        <span class="type">String</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>       方法1:

       router.destroy(&quot;page&quot;);</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_getPageParams" class="method item">
    <h3 class="name"><code>getPageParams</code></h3>

    
        <span class="paren">()</span>
    

    
        <span class="returns-inline">
            <span class="type">Object</span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l2118"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:2118</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>获取页面的参数,可以直接使用 bui.getPageParams() 方法获取</p>

    </div>

    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Object</span>:
                    
                    <p>option [返回对象]</p>

                
            </div>
        </div>
    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <p> 方法:</p>
<pre class="code prettyprint"><code>       var params = router.getPageParams();</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_getPartParams" class="method item">
    <h3 class="name"><code>getPartParams</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code class="optional">[id]</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type">object</span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l2139"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:2139</code></a>
        
        </p>


        

        
            <p>Available since 1.4.2</p>
        
    </div>

    <div class="description">
        <p>[获取当前页面下的局部模块参数]</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name optional">[id]</code>
                        <span class="type">String</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                        <p>[loadPart 局部加载的id, 1.5.2 可以不传,默认取最后一次执行的模块参数]</p>

                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">object</span>:
                    
                    <p>[返回得到的参数]</p>

                
            </div>
        </div>
    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>       loader.define(function(require,exports,module) {

         var pid = module.moduleName,
             params = router.getPartParams(pid);

       })</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_history" class="method item">
    <h3 class="name"><code>history</code></h3>

    
        <span class="paren">()</span>
    

    
        <span class="returns-inline">
            <span class="type">Object</span>
        </span>
    

    

    

    

    
        <span class="flag static">static</span>
    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l236"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:236</code></a>
        
        </p>


        

        
            <p>Available since 1.4.2</p>
        
    </div>

    <div class="description">
        <p>路由的历史记录对象</p>

    </div>

    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Object</span>:
                    
                    <p>[option]
         {object.get} [获取历史记录]
         {object.getLast} [获取最后一个历史记录]
         {object.check} [ 1.5.4新增, 检测有没有当前页面的历史记录]</p>

                
            </div>
        </div>
    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>       var _history = router.history.get();</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_init" class="method item">
    <h3 class="name"><code>init</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code class="optional">[option]</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    

    
        <span class="flag chainable">chainable</span>
    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l480"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:480</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>路由初始化,用于实例化以后的配置参数修改,参数同上</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name optional">[option]</code>
                        <span class="type">Object</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>      // 路由初始化, 默认会加载main模块
       router.init({
           id: &quot;#bui-router&quot;
       })</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_initScroll" class="method item">
    <h3 class="name"><code>initScroll</code></h3>

    
        <span class="paren">()</span>
    

    
        <span class="returns-inline">
            <span class="type">Object</span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l2454"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:2454</code></a>
        
        </p>


        

        
            <p>Available since 1.4.3</p>
        
    </div>

    <div class="description">
        <p>单页里面如果需要设置footer显示隐藏,会导致初始化高度不准确,需要手动设置</p>

    </div>

    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Object</span>:
                    
                    <p>[路由本身]</p>

                
            </div>
        </div>
    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>       var currentPage = router.currentPage();

       // 例如, 按钮点击的时候,需要显示底部隐藏
       $(&quot;.btn&quot;).on(&quot;click&quot;,function (e) {

         // 获取当前页的底部
         $(&quot;footer&quot;,currentPage).hide();

         // 执行一次滚动初始化
         router.initScroll();

       })</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_isLoad" class="method item">
    <h3 class="name"><code>isLoad</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code class="optional">[pid]</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type">Boolean</span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l2173"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:2173</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>默认检查模块是否已经加载过,防止事件重复绑定</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name optional">[pid]</code>
                        <span class="type">String</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                        <p>[检查某个模块是否已经加载过]</p>

                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Boolean</span>:
                    
                
            </div>
        </div>
    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>       var isLoad = router.isLoad(&quot;main&quot;);</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_load" class="method item">
    <h3 class="name"><code>load</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code class="optional">[option]</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    

    
        <span class="flag chainable">chainable</span>
    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l971"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:971</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>页面跳转, 也支持定义好的模块跳转, 保持跟 bui.load一致</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name optional">[option]</code>
                        <span class="type">Object</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                        <ul class="params-list">
                            
                            <li class="param">
                                
                                    <code class="param-name">url</code>
                                    <span class="type">String</span>
                                

                                <div class="param-description">
                                    <p>[页面跳转的地址,支持两种跳转方式, 一种是直接输入跳转的完整地址,一种是通过map方法注册页面key值,都要保持唯一]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name">param</code>
                                    <span class="type">Object</span>
                                

                                <div class="param-description">
                                    <p>[传过去新页面的参数]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name">replace</code>
                                    <span class="type">Boolean</span>
                                

                                <div class="param-description">
                                    <p>[是否是替换当前页面]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name">autoInit</code>
                                    <span class="type">Boolean</span>
                                

                                <div class="param-description">
                                    <p>[1.5.2 默认是true, 自动计算 main 的高度, 如果跳转的页面有list,或者tab, 就可以不需要自动初始化]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name">iframe</code>
                                    <span class="type">Boolean</span>
                                

                                <div class="param-description">
                                    <p>[1.4.2新增支持iframe加载外部html]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name">callback</code>
                                    <span class="type">Boolean</span>
                                

                                <div class="param-description">
                                    <p>[1.4.6新增, 跳转后的回调]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[beforeLoad]</code>
                                    <span class="type">Function |  | Boolean</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[1.5.1默认: null 跳转前触发, 如果全局有,默认使用全局判断, 返回true 则忽略全局判断. ]</p>

                                </div>

                                
                            </li>
                            
                        </ul>
                    
                </li>
            
            </ul>
        </div>
    

    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>     // 方法: 模块名为: pages/page2/page2

       router.load({ url: &quot;pages/page2/page2.html&quot;, param: {} });</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_loadPart" class="method item">
    <h3 class="name"><code>loadPart</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code class="optional">[option]</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type">Object</span>
        </span>
    

    

    

    

    

    
        <span class="flag chainable">chainable</span>
    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l1687"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:1687</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>局部加载</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name optional">[option]</code>
                        <span class="type">Object</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                        <ul class="params-list">
                            
                            <li class="param">
                                
                                    <code class="param-name">id</code>
                                    <span class="type">String</span>
                                

                                <div class="param-description">
                                    <p>[ 加载的容器 ]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name">url</code>
                                    <span class="type">String</span>
                                

                                <div class="param-description">
                                    <p>[ 加载的地址,可以是一个模块 ]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[param]</code>
                                    <span class="type">Object</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[ 传递给该模块的参数 ]</p>

                                </div>

                                
                            </li>
                            
                        </ul>
                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Object</span>:
                    
                    <p>[ 新增1.4.2 返回一个 Deferred 对象 ]</p>

                
            </div>
        </div>
    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <p> 方法1: 加载某个模块到页面的id=part2, 模块名为: pages/page2/page2</p>
<pre class="code prettyprint"><code>       router.loadPart({ id:&quot;#part2&quot;, url: &quot;pages/page2/page2.html &quot;});

       // 方法2: 新增回调

       router.loadPart({
             url: &quot;pages/page2/page2.html&quot;,
             param: {}
       }).then(function (module) {
         // 加载模块以后执行
       });</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_option" class="method item">
    <h3 class="name"><code>option</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code class="optional">[key]</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code class="optional">[value]</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    

    
        <span class="flag chainable">chainable</span>
    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l2306"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:2306</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>获取设置参数</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name optional">[key]</code>
                        <span class="type">String | object</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                        <p>[ 不传则获取所有参数, 类型为string,没有第2个参数则获取某个参数 ]</p>

                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name optional">[value]</code>
                        <span class="type">String | number | boolean | function</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                        <p>[ 设置参数的时候要传,设置多个参数不用传,获取参数的时候也不用传 ]</p>

                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>       //获取所有参数
       var option = router.option();

       //获取某个参数
       var effect = router.option( &quot;effect&quot; );

       //修改一个参数
       router.option( &quot;effect&quot;,&quot;cover&quot; );

       //修改多个参数
       router.option( {&quot;effect&quot;:&quot;cover&quot;} );</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_preload" class="method item">
    <h3 class="name"><code>preload</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>option</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type">Object</span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l869"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:869</code></a>
        
        </p>


        

        
            <p>Available since 1.4.2</p>
        
    </div>

    <div class="description">
        <p>[预加载页面及资源,webapp预加载有助于网络较慢时,或者网络不通时,点击无法跳转响应等问题. ]</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">option</code>
                        <span class="type">Object | Array</span>
                    

                    

                    <div class="param-description">
                        <p>[description]</p>

                    </div>

                    
                        <ul class="params-list">
                            
                            <li class="param">
                                
                                    <code class="param-name">url</code>
                                    <span class="type">String</span>
                                

                                <div class="param-description">
                                    <p>[缓存的模板地址,会自动缓存模板对应的脚本文件]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[style]</code>
                                    <span class="type">String | Array</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[非必须,缓存样式文件]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[script]</code>
                                    <span class="type">String | Array</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[非必须,缓存脚本文件,跟模板同名以外的脚本]</p>

                                </div>

                                
                            </li>
                            
                        </ul>
                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Object</span>:
                    
                    <p>[ 返回一个 Deferred 对象 ]</p>

                
            </div>
        </div>
    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>       // 预加载一个页面
       router.preload({ url: &quot;pages/page2/page2.html &quot; });

       // 预加载多个页面
       router.preload([{
           url: &quot;pages/about/index.html&quot;
         },{
           url: &quot;pages/router/index.html&quot;
       }]).then(function () {
           // 全部加载以后执行
       })</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_refresh" class="method item">
    <h3 class="name"><code>refresh</code></h3>

    
        <span class="paren">()</span>
    

    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l2062"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:2062</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>刷新当前页</p>

    </div>

    

    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>       // 方法:
       router.refresh();</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_replace" class="method item">
    <h3 class="name"><code>replace</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code class="optional">[option]</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type">Object</span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l2089"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:2089</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>替换当前页面,为新页面</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name optional">[option]</code>
                        <span class="type">Object</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                        <ul class="params-list">
                            
                            <li class="param">
                                
                                    <code class="param-name">url</code>
                                    <span class="type">String</span>
                                

                                <div class="param-description">
                                    <p>[加载的地址]</p>

                                </div>

                                
                            </li>
                            
                            <li class="param">
                                
                                    <code class="param-name optional">[param]</code>
                                    <span class="type">Object</span>
                                    <span class="flag optional" title="This parameter is optional.">optional</span>
                                

                                <div class="param-description">
                                    <p>[传参]</p>

                                </div>

                                
                            </li>
                            
                        </ul>
                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Object</span>:
                    
                
            </div>
        </div>
    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>       router.replace({
           url: &quot;pages/page3/page3.html&quot;
       });</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="method_resize" class="method item">
    <h3 class="name"><code>resize</code></h3>

    
        <span class="paren">()</span>
    

    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l575"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:575</code></a>
        
        </p>


        

        
            <p>Available since 1.5.1</p>
        
    </div>

    <div class="description">
        <p>[重新设置路由宽高 ]</p>

    </div>

    

    

    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>       // 重新设置路由宽高
       router.resize();</code></pre>

            </div>
        </div>
    
</div>

                
            </div>
        

        

        

        
            <div id="events" class="api-class-tabpanel">
                <h2 class="off-left">Events</h2>

                
                    <div id="event_off" class="events item">
    <h3 class="name"><code>off</code></h3>
    <span class="type"></span>

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l2354"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:2354</code></a>
        
        </p>

        

        
            <p>Available since 1.3.0</p>
        
    </div>

    <div class="description">
        <p>为控件取消绑定事件</p>

    </div>

    
        <div class="params">
            <h4>Event Payload:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name optional">[type]</code>
                        <span class="type">String</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                        <p>[事件类型: &quot;init&quot; | &quot;refresh&quot;(刷新后触发) | &quot;loadfail&quot;(加载页面失败触发) | &quot;beforeload&quot;<del>&quot;loadbefore&quot;</del>(页面加载之前) | &quot;load&quot;(模块加载成功后触发,相同模板只加载一次) | &quot;loadpart&quot;(局部加载模块触发,相同模板只加载一次) | &quot;back&quot;(后退以后触发) | &quot;beforeback&quot; <del>&quot;backbefore&quot;</del>(后退前触发) | &quot;complete&quot;(页面完成时触发,load的时候就会触发) | &quot;pageshow&quot; 页面显示的时候 |&quot;pagehide&quot; 页面切换的时候 | &quot;resize&quot; 改变窗口的时候 | 1.5.3 新增监听某个页面显示的时候触发 &quot;pageshow-main&quot; main为首页模块名,其它页面默认是路径]</p>

                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name optional">[callback]</code>
                        <span class="type">Function</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                        <p>[ 监听事件以后执行 ]</p>

                    </div>

                    
                </li>
            
            </ul>
        </div>
    


    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>       router.off(&quot;refresh&quot;);</code></pre>

            </div>
        </div>
    
</div>

                
                    <div id="event_on" class="events item">
    <h3 class="name"><code>on</code></h3>
    <span class="type"></span>

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/_Users_wilson_personal_htdocs_opensource_bui-rollup_src_scripts_core_bui.router.js.html#l2332"><code>&#x2F;Users&#x2F;wilson&#x2F;personal&#x2F;htdocs&#x2F;opensource&#x2F;bui-rollup&#x2F;src&#x2F;scripts&#x2F;core&#x2F;bui.router.js:2332</code></a>
        
        </p>

        

        
            <p>Available since 1.3.0</p>
        
    </div>

    <div class="description">
        <p>为控件绑定事件,以下事件均为全局事件.
全局事件建议写在index.js监听, 如果写在当前模块里面监听,当路由的参数cache=false时,需要先off掉,否则会有加载两次的,如果cache=true,相同模板只执行1次,则不需要off</p>

    </div>

    
        <div class="params">
            <h4>Event Payload:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name optional">[type]</code>
                        <span class="type">String</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                        <p>[事件类型: &quot;init&quot; | &quot;refresh&quot;(刷新后触发) | &quot;loadfail&quot;(加载页面失败触发) | &quot;beforeload&quot;<del>&quot;loadbefore&quot;</del>(页面加载之前) | &quot;load&quot;(模块加载成功后触发,相同模板只加载一次) | &quot;loadpart&quot;(局部加载模块触发,相同模板只加载一次) | &quot;back&quot;(后退以后触发) | &quot;beforeback&quot; <del>&quot;backbefore&quot;</del>(后退前触发) | &quot;complete&quot;(页面完成时触发,load的时候就会触发) | &quot;pageshow&quot; 页面显示的时候 |&quot;pagehide&quot; 页面切换的时候  | &quot;resize&quot; 改变窗口的时候 | 1.5.3 新增监听某个页面显示的时候触发 &quot;pageshow-main&quot; main为首页模块名,其它页面默认是路径]</p>

                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name optional">[callback]</code>
                        <span class="type">Function</span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                        <p>[ 监听事件以后执行 ]</p>

                    </div>

                    
                </li>
            
            </ul>
        </div>
    


    
        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code>         router.on(&quot;refresh&quot;,function () {
             // 点击的菜单
             console.log(this);
         });</code></pre>

            </div>
        </div>
    
</div>

                
            </div>
        
    </div>
</div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
<!-- 百度统计 -->
<script>
var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?1e19beda5d47048a31939f0f67d9b1f9";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>


</body>
</html>
